package com.homework.dao.impl;

import com.homework.dao.ArticleDao;
import com.homework.domain.Article;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class ArticleDaoImpl implements ArticleDao {

    //dao层采用JDBCTemplate
    @Autowired
    private JdbcTemplate jdbcTemplate;

    public void save(Article article) {
//        String sql = "INSERT INTO article VALUES (null, ?,? )";

        int update = jdbcTemplate.update("INSERT INTO article VALUES (null, ?,? )", article.getHeadline(), article.getContent());

        System.out.println("添加成功");

    }
}
